<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="layout" uri="http://code.google.com/p/layout4j/" %>
<%@ attribute name="source" required="true" description="Source LayoutML" %>
<%@ attribute name="contentBaseUrl" required="true" description="For example, 'http://foo.bar.com/content.html?'" %>
<%@ attribute name="contentServerCheckUrl" required="false" description="TODO: For example, http://foo.bar.com/serverCheck.html" %>
<%@ attribute name="timeoutMillis" required="false" description="TODO" %>
<layout:render source="${source}">
  <jsp:attribute name="layoutStart">
    <c:set var="maxColsAttr"></c:set>
    <c:if test="${!empty layoutMaxCols}">
    	<c:set var="maxColsAttr">cms-max-cols='${layoutMaxCols}'</c:set>
    </c:if>
    <!-- XXX: id="grid" is dirty -->
    <div id="layout-editor" ${maxColsAttr} >
  </jsp:attribute>
  <jsp:attribute name="layoutEnd">
    </div>
  </jsp:attribute>

  <jsp:attribute name="rowStart">
    <c:set var="maxColsAttr"></c:set>
    <c:if test="${!empty layoutRowMaxCols}">
    	<c:set var="maxColsAttr">cms-max-cols='${layoutRowMaxCols}'</c:set>
    </c:if>
    <div cms-type="row" class="row" ${maxColsAttr} >
  </jsp:attribute>
  <jsp:attribute name="rowEnd">
    </div>
  </jsp:attribute>

  <jsp:attribute name="columnStart">
  	<c:set var="maxColsAttr"></c:set>
    <c:if test="${!empty layoutColumnMaxCols}">
    	<c:set var="maxColsAttr">cms-max-cols='${layoutColumnMaxCols}'</c:set>
    </c:if>
    <div cms-type="column" class="column ${(layoutColumnAside == 'true') ? 'aside' : ''}" 
    		${maxColsAttr} ${(layoutColumnAside == "true") ? "cms-aside='true'" : ""}>
  </jsp:attribute>
  <jsp:attribute name="columnEnd">
    </div>
  </jsp:attribute>
        
  <jsp:attribute name="contentStart">
	<c:import url="${contentBaseUrl}dataId=${layoutContentDataId}&dataTypeId=${layoutContentDataTypeId}&styleId=${layoutContentStyleId}" />
  </jsp:attribute>
</layout:render>
